// Fill out your copyright notice in the Description page of Project Settings.


#include "Meat.h"
#include "MyCharacter.h"

void AMeat::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp,
	int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) 
{
	Super::OnOverlapBegin(OverlappedComponent,OtherActor,OtherComp,OtherBodyIndex,bFromSweep,SweepResult);
	if (OtherActor) 
	{
		AMyCharacter* Player = Cast<AMyCharacter>(OtherActor);	
		if (Player) 
		{
			Player->PickupMeat(MeatType::Meat, 1);
			Destroy();
		}
	}
}

void AMeat::OnOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp,
	int32 OtherBodyIndex) 
{
	Super::OnOverlapEnd(OverlappedComponent,OtherActor,OtherComp,OtherBodyIndex);
	UE_LOG(LogTemp, Warning, TEXT("%s"), *FString(__FUNCTION__));
}